package com.mangosteen.app.controller;

import com.mangosteen.app.model.dao.UserInfo;
import lombok.val;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class HelloController {
    @GetMapping("v1.0/hello/{name}")
    public String sayHello(@PathVariable("name") String name) {
        return String.format("Hello %s", name);
    }

    @GetMapping("v1.0/greeting")
    public String sayGreeting(@RequestParam("name") String name, @RequestParam("id") Long id) {
        val userInfo = UserInfo.builder()
                                .username("xxxx")
                                .build();
        System.out.println(userInfo.getUsername());
        return String.format("Greeting %s with %d", name, id);
    }
}
